# 基本整型定义
positive = 42
negative = -15
zero = 0

print(f"positive: {positive}, 类型: {type(positive)}")  # <class 'int'>
print(f"negative: {negative}, 类型: {type(negative)}")  # <class 'int'>
print(f"zero: {zero}, 类型: {type(zero)}")              # <class 'int'>


# 使用下划线提高可读性 (Python 3.6+)
large_number = 1_000_000
print(f"大数字: {large_number},类型：{type(large_number)},计算: {large_number+200}")

largest_number = 123456_7
print(f"大数字: {largest_number},类型：{type(largest_number)},计算: {largest_number+1}")


credit_card = 1234_5678_9012_3456
print(f"信用卡号: {credit_card},类型：{type(credit_card)}")

bytes_value = 0b1100_1010_1111_0101
print(f"字节值: {bytes_value}，类型：{type(bytes_value)}")


#类型转换
# 其他类型转整型
print("类型转换:")
print(f"int(3.14) = {int(3.14)}")          # 浮点数转整型 (截断小数)
print(f"int(-2.99) = {int(-2.99)}")        # -2
print(f"int('100') = {int('100')}")        # 字符串转整型
print(f"int('1010', 2) = {int('1010', 2)}") # 二进制字符串转十进制
print(f"int('FF', 16) = {int('FF', 16)}")  # 十六进制字符串转十进制
print(f"int(True) = {int(True)}")          # 布尔值转整型 (True=1)
print(f"int(False) = {int(False)}")        # 布尔值转整型 (False=0)

